﻿using System;
using System.Runtime.Serialization;

namespace NetBay.Core.BusinessEntities.Versioning
{
    /// <summary>
    /// Represent a versioning model type used by a documentype
    /// </summary>
    [DataContract]
    public class VersioningModel : ReturnObject
    {
        #region Properties

        /// <summary>
        /// Get or set the Model identifier
        /// </summary>
        [DataMember]
        public int Identifier { get; set; }

        /// <summary>
        /// Get or set the version type
        /// </summary>
        [DataMember]
        public VersionType ModelType { get; set; }

        /// <summary>
        /// Get or set the maximum of major version
        /// </summary>
        [DataMember]
        public int MaxMajorVersion { get; set; }

        /// <summary>
        /// Get or set the maximum of minor version (for a major version)
        /// </summary>
        [DataMember]
        public int MaxMinorVersion { get; set; }
        
        /// <summary>
        /// Get or set a value that indicates whether the model is enabled
        /// </summary>
        [DataMember]
        public bool IsEnabled { get; set; }

        /// <summary>
        /// Get or set the workflow identifier associate to the model
        /// </summary>
        [DataMember]
        public long WorkFlow { get; set; }

        #endregion

        #region Constructors

        public VersioningModel()
        {
            ModelType = VersionType.None;
            MaxMajorVersion = 0;
            MaxMinorVersion = 0;
            IsEnabled = true;
            WorkFlow = 0;
            Identifier = 0;
        }

        /// <summary>
        /// Only for error
        /// </summary>
        /// <param name="ErrorMessage"></param>
        public VersioningModel(string errorMessage, Exception applicationException = null)
            : base(errorMessage, applicationException)
        {
        }

        #endregion

    }
}
